<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class SpaceInputDTO extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     * 'groupId', 'name', 'email', 'mobile'
     * @return array
     */
    public function rules()
    {
        return [
            'serial' => 'required|max:10',
            'description' => 'required|max:32',
            'width'  => 'required|numeric',
            'height' => 'required|numeric',
            'repeat' => 'required|numeric',
        ];
    }

    public function messages()
    {
        return [
            'serial.required' => '广告位编号不能为空',
            'serial.max' => '广告位编号不能超过10个字符',
            'description.required' => '位置描述不能为空',
            'description.max' => '位置描述不能超过32个字符',
            'width.numeric' => '宽度必须是数字',
            'width.required' => '宽度不能为空',
            'height.numeric' => '高度必须是数字',
            'height.required' => '高度不能为空',
            'repeat.required' => 'repeat不能为空',
            'repeat.numeric' => 'repeat必须是数字',
        ];
    }
}
